from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from users import views

urlpatterns = [
    # 注册页面
    url(r'^register/', views.Register.as_view()),
    # 检查用户名是否重复
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/', views.UsernameCount.as_view()),
    # 检查手机号码是否重复
    url(r'^mobiles/(?P<mobile>1[345789]\d{9})/count/', views.MobileCount.as_view()),
    # 用户登陆页面
    url(r'^login/$', views.LoginView.as_view()),
    # 用户退出登陆页面
    url(r'^logout/$', views.LogoutView.as_view()),
    # 用户中心页面
    # url(r'^info/$', login_required(views.InfoView.as_view())),
    url(r'^info/$', views.InfoView.as_view()),

    url(r'^emails/$', views.EmailVerify.as_view()),
    url(r'^emails/verification/$', views.EmailGet.as_view()),
    # 用户中心新增地址
    url(r'^addresses/create/$', views.AddressCreate.as_view()),
    # 用户中心设置默认地址
    url(r'^addresses/(?P<id>\d+)/default/$', views.DefaultAddress.as_view()),
    # 用户中心修改地址，删除地址
    url(r'^addresses/(?P<id>\d+)/$', views.ChangeAddress.as_view()),
    # 用户中心修改标题
    url(r'^addresses/(?P<id>\d+)/title/$', views.ChangeTitle.as_view()),
    # 用户中心修改密码
    url(r'^password/$', views.ChangePassword.as_view()),
    url(r'^browse_histories/$', views.UserHistories.as_view()),

]


